<%@ page language="java" import="java.util.*" pageEncoding="utf-8" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ page language="java" import="java.lang.Math" %>
<%@ page language="java" import="java.lang.Integer" %>
<!DOCTYPE html>
<%@ include file="console_element/top.jsp" %>
<div id="main">
    <%@ include file="console_element/left.jsp" %>
    <div id="opt_area">
        <ul class="classlist" id="newsList">
            <c:forEach items="${news.list}" var="news" varStatus="i">
                <li>${news.ntitle}
                    <span>
                        作者：${empty news.nauthor or news.nauthor.trim()=="" ? '佚名' : news.nauthor} &#160;&#160;&#160;&#160;
                        <c:if test="${!empty sessionScope.user && sessionScope.user.urole==2}">
                            <a href='<%=basePath%>news/toModify?nid=${news.nid}'>修改</a> &#160;&#160;&#160;&#160;
                            <a href='<%=basePath%>news/delete?nid=${news.nid}'
                               onclick='return clickdel()'>删除</a>
                        </c:if>
                    </span>
                </li>
                <c:if test="${i.count % 5 == 0}">
                    <li class='space'></li>
                </c:if>
            </c:forEach>

            <p align="center"> 当前页数:[${news.pageIndex}/${Math.max(news.totalPages,Integer.valueOf(1))}]&nbsp;
                <c:if test="${news.pageIndex > 1}">
                    <a href="<%=basePath%>news/list?pageIndex=1">首页</a>&nbsp;
                    <a href="<%=basePath%>news/list?pageIndex=${news.pageIndex - 1}">上一页</a>
                </c:if>
                <c:if test="${news.pageIndex < news.totalPages}">
                    <a href="<%=basePath%>news/list?pageIndex=${news.pageIndex + 1}">下一页</a>
                    <a href="<%=basePath%>news/list?pageIndex=${news.totalPages}">末页</a>
                </c:if>
            </p>
        </ul>
    </div>
</div>
<%@ include file="console_element/bottom.html" %>

